package com.health.domain.dao;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.health.domain.model.User;
import com.health.framework.dao.BaseDao;

@Repository
@SuppressWarnings("unchecked")
public class UserDao extends BaseDao<User, Integer> {

    public User getByUsername(final String username) throws DataAccessException {
        List<User> lstUser = super.getHibernateTemplate().find("from User where username = ?", username);
        return lstUser.isEmpty() ? null : lstUser.get(0);
    }
    
}
